<script setup lang="ts">
import { useThemeStore } from './stores';
import { computed } from 'vue';

const themeStore = useThemeStore();
const currentTheme = computed(() => themeStore.theme);

function toggleTheme() {
  themeStore.toggleTheme();
}
</script>

<template>
  <div class="app-container" :data-theme="currentTheme">
    <header class="app-header">
      <div class="container header-content">
        <h1 class="app-title">Mai-Ya AI绘画</h1>
        <nav class="app-nav">
          <router-link to="/" class="nav-link">首页</router-link>
          <router-link to="/image-to-prompt" class="nav-link">图生文</router-link>
          <router-link to="/upload" class="nav-link">AI绘画</router-link>
        </nav>
        <button @click="toggleTheme" class="theme-toggle btn btn-secondary">
          {{ currentTheme === 'light' ? '☀️' : '🌙' }}
        </button>
      </div>
    </header>

    <main class="app-main">
      <div class="container">
        <router-view />
      </div>
    </main>

    <footer class="app-footer">
      <div class="container">
        <p>© {{ new Date().getFullYear() }} Mai-Ya AI绘画平台</p>
      </div>
    </footer>
  </div>
</template>

<style>
.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  background-color: var(--bg-secondary);
  box-shadow: var(--shadow-sm);
  padding: 1rem 0;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.app-title {
  font-size: 1.5rem;
  color: var(--primary-color);
  margin: 0;
}

.app-nav {
  display: flex;
  gap: 1.5rem;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition-fast);
}

.nav-link:hover,
.nav-link.router-link-active {
  color: var(--primary-color);
}

.theme-toggle {
  font-size: 1.25rem;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-main {
  flex: 1;
  /* padding: 2rem 0; */
}

.app-footer {
  background-color: var(--bg-secondary);
  padding: 0.3rem 0;
  text-align: center;
  color: var(--text-tertiary);
  margin-top: auto;
}
</style>
